package jp.sourceforge.akjrcp.dropsomething2;

import jp.sourceforge.akjrcp.akj_betas.Akj_betasPlugin;
import jp.sourceforge.akjrcp.akj_betas.Messages;
import jp.sourceforge.akjrcp.util.ClipboardUtil;

import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;

public class InfoDialog extends MessageDialog{

	private Text text;
	private String message;
	public InfoDialog(Shell parentShell, String dialogTitle, Image dialogTitleImage, String dialogMessage, int dialogImageType, String[] dialogButtonLabels, int defaultIndex) {
		super(parentShell, dialogTitle, dialogTitleImage, "",
				dialogImageType, dialogButtonLabels, defaultIndex);
		message=dialogMessage;
		// TODO Auto-generated constructor stub
	}
	
	  protected Control createCustomArea(Composite parent) {
		  
		  
		    Composite root=new Composite(parent,SWT.NULL);
		    root.setLayoutData(new GridData(GridData.FILL_BOTH));
		    root.setLayout(new GridLayout(1,false));
		    Composite controls=new Composite(root,SWT.NULL);
		    controls.setLayout(new GridLayout());
		    
		    
		    
		    Button reportButton=new Button(controls,SWT.NULL);
		    reportButton.setText(Messages.getString("ffmpegconvert.copy_clipboard"));
		    reportButton.addSelectionListener(new SelectionListener(){

				public void widgetDefaultSelected(SelectionEvent e) {
						
				}

				public void widgetSelected(SelectionEvent e) {
					String log=text.getText();
					
					ClipboardUtil.setClipboard(getShell().getDisplay(), log);
				}});
		    
		   
		    
		    Composite panel=new Composite(root,SWT.NULL);
		    panel.setLayout(new FillLayout());
		    //panel.setLayout(new RowLayout());
		    text = new Text(root,SWT.BORDER|SWT.WRAP|SWT.READ_ONLY|SWT.MULTI|SWT.V_SCROLL);
		   
		    GridData data=new GridData(GridData.FILL_BOTH);//for vista//TODO still here is problem
		    data.heightHint=400;
		    
		    //data.grabExcessVerticalSpace=true;
		    data.widthHint=480;
		    //data.grabExcessHorizontalSpace=true;
		   text.setLayoutData(data); 
		   
	       text.setText(message);
	        
	        
	       
	      
	        return panel;
	    }



}
